#pragma once
#include "TargetView.h"
#include "Target.h"
class OceanTargetView:public TargetView
{
public:

	virtual void drawTarget(CTarget* target, CPaintDC* dc)
    { 
		CGdiObject *oldBrush = dc->SelectStockObject(DC_BRUSH);
		CGdiObject *oldPen = dc->SelectStockObject(DC_PEN);
		if(target->getState()==CTarget::NORMAL_STATE)
			dc->SetDCBrushColor(RGB(0,255,0));
		else if(target->getState()==CTarget::CRITICAL_STATE)
			dc->SetDCBrushColor(RGB(255,0,0));
		else if(target->getState()==CTarget::WARNING_STATE)
			dc->SetDCBrushColor(RGB(255,255,0));
		//dc->SetDCPenColor(RGB(0,0,0));
		dc->BeginPath();
		dc->MoveTo(target->getPosition()->x-10,target->getPosition()->y-10);
		dc->LineTo(target->getPosition()->x+10,target->getPosition()->y-10);
		dc->LineTo(target->getPosition()->x+10,target->getPosition()->y+10);
		dc->LineTo(target->getPosition()->x-10,target->getPosition()->y+10);
		dc->LineTo(target->getPosition()->x-10,target->getPosition()->y-10);
		dc->EndPath();
		dc->FillPath();
		//dc->Ellipse(source->getPosition()->x-10,source->getPosition()->y-10,source->getPosition()->x+10,source->getPosition()->y+10);
		dc->SelectObject(oldBrush);
		dc->SelectObject(oldPen);


		dc->TextOut(target->getPosition()->x-10, target->getPosition()->y-25, target->getName().data());
		
		 char* str = new char[30];
		 sprintf(str, "%.4g", target->getPower());  
		 
		  
        dc->TextOut(target->getPosition()->x-10, target->getPosition()->y+10, str);
		
    }

	OceanTargetView(void);
	~OceanTargetView(void);
};

